<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <p style="font-size: 0.1rem;">
      状体
    </p>
    <script>
      ;(function () {
        console.log(window)

        let resizeEvent =
          "orientationchange" in window ? "orientationchange" : "resize"
        let resetFontSize = function () {
          let winW = window.innerWidth
          let html = document.documentElement
          if (winW >= 1225) {
            html.style.fontSize = (winW * 100) / 960 + "px"
          } else {
            html.style.fontSize = (1225 * 100) / 960 + "px"
          }
          console.log(html.style.fontSize)
        }

        window.addEventListener(resizeEvent, resetFontSize, false)
        document.addEventListener("DOMContentLoaded", resetFontSize, false)
      })()
    </script>
  </body>
</html>
